package sync
{
	import events.P2PMessageEvent;
	
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;

	public class P2PMessageSender extends EventDispatcher
	{
		/**
		 * This class is responsible for sending to the other peers the actions the current user has been applying to his objects
		 * and his white board
		 */
		public function P2PMessageSender(target:IEventDispatcher = null)
		{
			super(target)
		}
		
		public function sendObject(objectToSend:Object):void
		{
			var event:P2PMessageEvent = new P2PMessageEvent(P2PMessageEvent.SEND_MESSAGE);
			//simplify the object to reduce the bandwith usage 
			event.objectToSend = objectToSend;
			dispatchEvent(event);
		}
	}
}